@extends("layout.main")

@section("content")
    <div class="col-sm-8 blog-main">
        <div class="blog-post">
            <div style="display:inline-flex">
                <h2 class="blog-post-title">{{$drawer->title}}</h2>
                {{--@can('update', $drawer)--}}
                    {{--<a style="margin: auto" href="/posts/{{$drawer->id}}/edit">--}}
                        {{--<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>--}}
                    {{--</a>--}}
                {{--@endcan--}}

                {{--@can('delete', $drawer)--}}
                    {{--<a style="margin: auto" href="/posts/{{$drawer->id}}/delete">--}}
                        {{--<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>--}}
                    {{--</a>--}}
                {{--@endcan--}}
            </div>

            <p class="blog-post-meta">{{$drawer->created_at->diffForHumans()}} by <a href="#">{{$drawer->user->name}}</a></p>
            {{$drawer->intro}}
            <div>
                {{--@if($drawer->zan(\Auth::id())->exists())--}}
                    {{--<a href="/posts/{{$drawer->id}}/unzan" type="button" class="btn btn-primary btn-default">取消赞</a>--}}
                {{--@else--}}
                    {{--<a href="/posts/{{$drawer->id}}/zan" type="button" class="btn btn-primary btn-lg">赞</a>--}}
                {{--@endif--}}
            </div>
        </div>

        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">评论</div>

            <!-- List group -->
            <ul class="list-group">

                {{--@if(count($drawer->comments) > 0)--}}
                    {{--@foreach($drawer->comments as $comment)--}}
                        {{--<li class="list-group-item">--}}
                            {{--<h5>{{$comment->created_at}} by {{$drawer->user->name}}</h5>--}}
                            {{--<div>--}}
                                {{--{{$comment->content}}--}}
                            {{--</div>--}}
                        {{--</li>--}}
                    {{--@endforeach--}}
                {{--@endif--}}
            </ul>
        </div>

        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">发表评论</div>

            <!-- List group -->
            <ul class="list-group">
                <form action="/drawer/{{$drawer->id}}/comment" method="post">
                    {{csrf_field()}}
                    <input type="hidden" name="post_id" value="{{$drawer->id}}"/>
                    <li class="list-group-item">
                        <textarea name="comment" class="form-control" rows="10"></textarea>
                        <button class="btn btn-default" type="submit">提交</button>
                    </li>
                </form>

            </ul>
        </div>
    </div>
@endsection